
<?php

class Brothers extends Controller {

    public $base;
    public $css;
    //All of these functions load the css, base url, the header and footer for each view
        function __construct()
        {
            parent::Controller();
            $this->base = $this->config->item('base_url');
            $this->css = $this->config->item('css');
            $this->load->helper('url');
            $this->load->helper('form');
        }

        function roster()
	{
            //This function gets the undergraduates brothers information from the database
            //and loads it to the roster view

            $data['css'] = $this->css;
            $data['base'] = $this->base;
            $data['title'] = 'Chi Phi, Nu Delta: The Florida State Chapter';


            $this->load->model('brothersmodel');
            $rosterquery['query'] = $this->brothersmodel->get_brothers();

            $this->load->view('header', $data);
            $this->load->view('roster', $rosterquery);
            $this->load->view('footer');
        }

        function loginview()
        {
            //This function loads the login view
            $data['css'] = $this->css;
            $data['base'] = $this->base;
            $data['title'] = 'Chi Phi, Nu Delta: The Florida State Chapter';

            $this->load->view('header', $data);
            $this->load->view('login');
            $this->load->view('footer');
        }


        function login()
        {
            //This function denies or access the user into the secure login

            $data['css'] = $this->css;
            $data['base'] = $this->base;
            $data['title'] = 'Chi Phi, Nu Delta: The Florida State Chapter';

            $this->load->model('brothersmodel');
            $loginquery['loggedin'] = $this->brothersmodel->get_login();
            if ($loginquery['loggedin'] == null)
                $loginquery['False'] = "Not passed";
            else
                $loginquery['True'] = "Passed";

            $this->load->view('header', $data);
            $this->load->view('login', $loginquery);
            $this->load->view('footer');
        }

}

?>
